<template>
  <div class="my">
    <div class="top">
      <div class="top1">
        <div class="left">
          <div class="left-name">{{ userInfo.nickname }}</div>
          <div class="left-text">{{ userInfo.intro }}</div>
        </div>
        <img
          @click="$router.push('/home/myInfo')"
          class="right"
          v-if="userInfo.avatar"
          :src="baseUrl + userInfo.avatar"
        />
        <img class="right" v-else src="@/assets/1.png" />
      </div>
      <ul class="top2">
        <li class="top2-item">
          <div class="num">298</div>
          <div class="txt">累计洗浴</div>
        </li>
        <li class="top2-item">
          <div class="num">298</div>
          <div class="txt">累计洗浴</div>
        </li>
        <li class="top2-item">
          <div class="num">298</div>
          <div class="txt">累计洗浴</div>
        </li>
        <li class="top2-item">
          <div class="num">298</div>
          <div class="txt">累计洗浴</div>
        </li>
      </ul>
      <div class="top3">
        <!-- <div class="box">123</div> -->
        <myCell
          class="box"
          title="我的岗位"
          :value="userInfo.position"
          icon="&#xe64d;"
        ></myCell>
      </div>
    </div>
    <div class="content">
      <div class="middle">
        <h3 class="middle-title">面经数据</h3>
        <ul class="middle-content">
          <li class="middle-item">
            <div class="item-top">昨日阅读<span>+300</span></div>
            <div class="item-content">17</div>
            <div class="item-bottom">阅读总数</div>
          </li>
          <li class="middle-item">
            <div class="item-top">昨日阅读<span>+300</span></div>
            <div class="item-content">17</div>
            <div class="item-bottom">阅读总数</div>
          </li>
          <li class="middle-item">
            <div class="item-top">昨日阅读<span>+300</span></div>
            <div class="item-content">17</div>
            <div class="item-bottom">阅读总数</div>
          </li>
        </ul>
      </div>
      <div class="bottom">
        <myCell
          title="我的岗位xxx"
          value="产品经理xxx"
          icon="&#xe64d;"
        ></myCell>
        <myCell></myCell>
        <myCell></myCell>
        <myCell></myCell>
        <myCell></myCell>
        <myCell></myCell>
      </div>
    </div>
  </div>
</template>

<script>
// 引入 mapState
import { mapState } from 'vuex'

import myCell from './myCell'
export default {
  components: {
    myCell
  },
  data () {
    return {
      baseUrl: process.env.VUE_APP_baseURL
    }
  },
  // 解决 背景颜色高度填不满的问题
  mounted () {
    document.querySelector('body').style.backgroundColor = '#f7f4f5'
  },
  destroyed () {
    document.querySelector('body').style.backgroundColor = '#fff'
  },
  computed: {
    ...mapState(['userInfo'])
    // userInfo () {
    //   return this.$store.state.userInfo
    // }
  }
}
</script>

<style lang="less">
.my {
  .top {
    position: relative;
    padding: 31px @p15 0;
    background-color: #bf002d;
    .top1 {
      display: flex;
      justify-content: space-between;

      .left {
        flex: 1;
        .left-name {
          font-size: 21px;
          font-family: PingFangSC, PingFangSC-Semibold;
          font-weight: 600;
          text-align: left;
          color: #ffffff;
          line-height: 30px;
          letter-spacing: 0px;
        }
        .left-text {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: left;
          color: #ffffff;
          line-height: 16px;
          letter-spacing: 0px;
        }
      }
      .right {
        width: 50px;
        height: 50px;
        border: 3px solid rgba(255, 255, 255, 0.38);
        border-radius: 50%;
      }
    }
    .top2 {
      display: flex;
      margin-top: 31px;
      padding-bottom: 55px;
      justify-content: space-between;
      .top2-item {
        text-align: center;
        .num {
          font-size: 21px;
          font-family: DINAlternate, DINAlternate-Bold;
          font-weight: 700;
          text-align: center;
          color: #ffffff;
          line-height: 24px;
          letter-spacing: 0px;
        }
        .txt {
          opacity: 0.7;
          font-size: 12px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: center;
          color: #ffffff;
          line-height: 16px;
          letter-spacing: 0px;
        }
      }
    }
    .top3 {
      position: absolute;
      left: 0;
      bottom: -16px;
      width: 100%;
      padding: 0 @p15 0;
      .box {
        height: 55px;
        border-radius: 8px;
        background-color: #fff;
      }
    }
  }
  .content {
    padding: 26px @p15 0;
    background-color: #f7f4f5;
    .middle {
      padding: 19px 15px;
      background-color: #fff;
      .middle-title {
        font-size: 14px;
        font-family: PingFangSC, PingFangSC-Semibold;
        font-weight: 600;
        text-align: left;
        color: #181a39;
        line-height: 20px;
        letter-spacing: 0px;
        margin-bottom: 17px;
      }
      .middle-content {
        display: flex;
        justify-content: space-between;
        .middle-item {
          .item-top {
            font-size: 12px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #b4b4bd;
            line-height: 14px;
            letter-spacing: 0px;
            span {
              color: #00b8d4;
            }
          }
          .item-content {
            font-size: 21px;
            font-family: DINAlternate, DINAlternate-Bold;
            font-weight: 700;
            text-align: center;
            color: #181a39;
            line-height: 24px;
            letter-spacing: 0px;
            margin: 10px 0 6px;
          }
          .item-bottom {
            font-size: 12px;
            font-family: PingFangSC, PingFangSC-Regular;
            font-weight: 400;
            text-align: center;
            color: #545671;
            line-height: 16px;
            letter-spacing: 0px;
          }
        }
      }
    }
    .bottom {
      margin-top: 10px;
    }
  }
}
</style>
